  <?php if (!empty($special_products)): ?>
  <?php $i = 0; ?>
  <?php $j = 0; ?>
  <div class="row" style="background-color: #ececec; margin-top: 14px;"> 
    <link href="<?php echo base_url('theme/css/frontend/catslider.css'); ?>" rel="stylesheet">
    <div id="mi-slider" class="mi-slider">
  	  <ul>
  	  <?php foreach ($special_products as $special_product): ?>
  	    <?php if($special_product['product_type'] == 1): ?>
  	      <?php if ($i > 4) { break; } ?>
  	      <?php $i++; ?>
  		  <li>
  		    <a href="#"><img src="<?php echo base_url("upload/booth/{$_SESSION['userLoggedIn']['id']}/products/avatar/{$special_product['id']}/{$special_product['avatar']}"); ?>" alt="img01">
  		      <h4><?php echo $special_product['name'] ?></h4>
  		      <p><?php echo $special_product['price'] ?> vnđ</p>
  		    </a>
  		  </li>
  		<?php endif; ?>
      <?php endforeach; ?>
  	  </ul>
  	  <ul>
  	  <?php foreach ($special_products as $special_product): ?>
  	    <?php if($special_product['product_type'] == 2): ?>
  	      <?php if ($j > 4) { break; } ?>
  	      <?php $j++; ?>
  		  <li>
  		    <a href="#"><img src="<?php echo base_url("upload/booth/{$_SESSION['userLoggedIn']['id']}/products/avatar/{$special_product['id']}/{$special_product['avatar']}"); ?>" alt="img01">
  		      <h4><?php echo $special_product['name'] ?></h4>
  		      <p><?php echo $special_product['price'] ?> vnđ</p>
  		    </a>
  		  </li>
  		<?php endif; ?>
      <?php endforeach; ?>
  	  </ul>
  	  <nav>
  	    <?php if($i): ?>
  		  <a href="#">Sản phẩm mới</a>
  		<?php endif; ?>
  		<?php if($j): ?>
  		  <a href="#">Sản phẩm khuyến mãi</a>
  		<?php endif; ?>
  	  </nav>
    </div>
    <script src="<?php echo base_url('theme/js/frontend/modernizr.custom.63321.js') ?>"></script>
    <script src="<?php echo base_url('theme/js/frontend/jquery.catslider.js') ?>"></script>
    <script>
  	  $(function() {
  	    $('#mi-slider').catslider();
  	  });
    </script>
  </div>
  <?php endif; ?>
  
  <div class="row" style="background-color: #ececec; margin-top: 2px;">  
    <style>
      #list-categories {
        position: relative;
    	z-index: 100;
      }
      .parent-categories {
        float: left;
        margin-left: 10px;
        padding: 4px;
        font-weight: bold;
        position: relative;
      }
      .parent-categories:hover {
        background-color: #DCDDDF;
      }
      .parent-categories:hover .list-child-categories {
        background-color: #DCDDDF;
        display: block;
      }
      .list-child-categories {
      	display: none;
      	background-color: #FFFFFF;
        left: 0;
        margin: 0;
        position: absolute;
        top: 28px;
        width: 220px;
        padding: 4px;
        z-index: 200;
      }
    </style>
    <a href="<?php echo base_url("booth_product_categories/index/{$booth['id']}"); ?>" >
      <img style="float:left; margin: 2px 6px 0;" src="<?php echo base_url('theme/images/icon/new.gif'); ?>" />
    </a>
    <b>Danh mục:</b>
    <?php if (isset($tree_booth_product_categories) && $tree_booth_product_categories): ?> 
      <ul id="list-categories">
        <?php foreach($tree_booth_product_categories as $parent_category): ?>
          <li class="parent-categories" data-category="<?php echo $parent_category['id']; ?>">
            <a href="javascript:void(0);"><?php echo $parent_category['name']; ?></a>
            <?php if (isset($parent_category['child'])): // children ?>          
              <ul class="list-child-categories">
                <?php foreach($parent_category['child'] as $child_category): ?>
                  <li class="child-categories" data-category="<?php echo $child_category['id']; ?>"><a href="javascript:void(0);"><?php echo $child_category['name']; ?></a></li>   
                <?php endforeach; ?>
              </ul>
            <?php endif; ?>
          </li>    
        <?php endforeach; ?>
      </ul>
    <?php endif; ?>
  </div>
  
  <style>
    #product-add-wrapper,
    #product-edit-wrapper {
      display: none;
    }
    /* Grid */
    #add-product {
      float: left;
  	  margin: 4px 0 0 4px;
  	  display: none;
    }
    #add-product img {
      width: 180px;
      height: 180px;
    }
    /* Form */
    .product-form-left {
      float: left;
      margin-right: 10px;
      width: 272px;
    }
    .form-horizontal .product-form-left input[type="text"]{
      width: 268px;
    }
    .form-horizontal .product-form-left select {
      width: 282px;
    }
    /* Tabs */
    .tabs-list {
      font-weight: bold;
      text-align: center;
      height: 32px;
      margin-bottom: 36px;
    }
    .tabs-list > li {
      background-color: #5080D8;
      border-right: 4px solid #cdcdcd;
      float: left;
      width: 109px;
      height: 32px;
    }
    .tabs-list > li.active {
      background-color: #0049BA;
    }
    .tabs-list > li > a {
      color: #FFFFFF;
      display: block;
      padding: 8px 2px 0;
    }
    .tab-content {
      display: none;
    }
    .tab-content:first-child {
      display: block;
    }
  </style>
  
  <!-- Grid Product -->
  <div class="row" >
    <ul class="thumbnails items" id="webbies" style="float: left;">
    </ul>
    <div id="add-product">
      <a href="javascript:void(0);">
        <img src="<?php echo base_url('theme/images/sample/booth/product.jpg'); ?>">
      </a>
    </div>
  </div>
  <!-- /Grid Product -->

  <!-- Add Product -->
  <div class="row" id="product-add-wrapper">
    <div style="padding: 10px 15px;margin-bottom: 10px; background-color: #CDCDCD">
      <h5>Ảnh đại diện sản phẩm</h5>
      <hr class="hr hr2" />
      <form method="post" id="avatar-add_form" class="form-horizontal" action=<?php echo base_url('booth_product/ajaxProductUploadFile/avatar'); ?> enctype=multipart/form-data > 
        <div class=control-group>
          <label for="avatar-add" class="control-label">Chọn ảnh<i>*</i></label>
         	<div class="controls">
         	  <input type="file" id="avatar-add" name="avatar-add"/>
         	</div>
        </div>
        <button class="submit_btn" type="submit">Upload Files</button>
      </form>
      <div id="avatar-add_append"></div>
    </div>
    <div style="padding: 10px 15px;margin-bottom: 10px; background-color: #CDCDCD">
      <h5>Album sản phẩm</h5>
      <hr class="hr hr2" />
      <form method="post" id="album-add_form" class="form-horizontal" action=<?php echo base_url('booth_product/ajaxProductUploadFile/album'); ?> enctype=multipart/form-data > 
        <div class=control-group>
          <label for="album-add" class="control-label">Chọn ảnh<i>*</i></label>
         	<div class="controls">
         	  <input type="file" id="album-add" name="album-add[]" multiple="multiple" />
         	</div>
        </div>
        <button class="submit_btn" type="submit">Upload Files</button>
      </form>
      <div id="album-add_append"></div>
    </div>
    <form method="post" class="form-horizontal" id="booth-product-form-add" action=<?php echo base_url('booth_product/add'); ?>>          
      <div class="product-form-left">
        <input type="hidden" name=category_id id="category-id-add" value="" />
        <input type="hidden" name=booth_id value="<?php echo $booth['id']; ?>" />
        <input type="hidden" id="avatar-addCropJson" name="avatar-addCropJson" />
        <input type="hidden" id="album-addCropJson" name="album-addCropJson" />
        <select name="product_type">
          <option value="0">Kiểu sản phẩm</option>  
          <option value="1">Sản phẩm mới</option>  
          <option value="2">Sản phẩm khuyến mại</option>  
        </select>
 	  	<input type=text name=intro_video placeholder="Video Youtube" >
        <input type=text name=name placeholder="Tên sản phẩm">
        <input type=text name=price placeholder="Giá bán">
        <input type=text name=base_price placeholder="Giá gốc">
        <select name="warranty">  
          <option value="0">Bảo hành</option>
          <option value="1">3 tháng</option>
          <option value="2">6 tháng</option>
          <option value="3">9 tháng</option>
          <option value="4">12 tháng</option>
          <option value="5">18 tháng</option>
          <option value="6">24 tháng</option> 
          <option value="7">36 tháng</option>  
        </select>
        <select name="status">
          <option value="0">Tình trạng</option>
          <option value="1">Còn hàng</option>  
          <option value="2">Hết hàng</option> 
        </select>
        <select name="forms">  
          <option value="0">Hình thức</option>
          <option value="1">Còn mới 30%</option>
          <option value="2">Còn mới 40%</option>
          <option value="3">Còn mới 50%</option>
          <option value="4">Còn mới 60%</option>
          <option value="5">Còn mới 70%</option> 
          <option value="6">Còn mới 80%</option>  
          <option value="7">Còn mới 90%</option>  
          <option value="8">Còn mới 92%</option>
          <option value="9">Còn mới 94%</option>
          <option value="10">Còn mới 96%</option>
          <option value="11">Còn mới 98%</option>
          <option value="12" selected>Còn mới 100%</option>  
        </select>
        <input type=text name=made_in placeholder="Xuất xứ">
	    <select name="shipping">  
	      <option value="0">Vận chuyển</option>
          <option value="1">Miễn phí</option>
          <option value="2">Có phí</option>
          <option value="3">Liên hệ</option>  
        </select>
        <input type=text name=quantity placeholder="Số lượng hàng">
        <input style="margin-top: -2px;" type="checkbox" value="1" name="make_as_homepage"> <b>Đưa ra trang chủ</b> <br />
        <div style="line-height: 14px;">Sản phẩm sẽ được chọn đưa ra ngoài trang chủ (lưu ý chỉ chọn một sản phẩm duy nhất)</div>
      </div>
      <div class="pull-left" style="width: 454px;">
        <div class=tabs>
          <div id="tab-1" class="tab-content" style="display: block;">
            <textarea name="description" id="description-add"></textarea>
            <script type="text/javascript">
		    //<![CDATA[    
		    epicEditor.init({
			  containId: 'description-add',
			  iframeId: 'epic_iframe_description-add',
			  toolbarId: 'epic_toolbar_group_description-add',					
			  buttons1 : 'bold,italic,underline,strikethrough,fontsize,fontname,justifyleft,justifycenter,justifyright,justifyfull,removeformat,inserthtml',
			  width:450,
			  height:282
		    });
		    //]]>
		    </script>
		  </div>
          <div id="tab-2" class="tab-content">
            <textarea name="product_information" id="product_information-add"></textarea>
            <script type="text/javascript">
		    //<![CDATA[    
		    epicEditor.init({
			  containId: 'product_information-add',
			  iframeId: 'epic_iframe_product_information-add',	
			  toolbarId: 'epic_toolbar_group_product_information-add',
			  buttons1 : 'bold,italic,underline,strikethrough,fontsize,fontname,justifyleft,justifycenter,justifyright,justifyfull,removeformat,inserthtml',
			  width:450,
			  height:282
		    });
		    //]]>
		    </script>
		  </div>
          <div id="tab-3" class="tab-content">
            <textarea name="product_detail" id="product_detail-add"></textarea>
            <script type="text/javascript">
            //<![CDATA[    
            epicEditor.init({
              containId: 'product_detail-add',
              iframeId: 'epic_iframe_product_detail-add',	
              toolbarId: 'epic_toolbar_group_product_detail-add',
              buttons1 : 'bold,italic,underline,strikethrough,fontsize,fontname,justifyleft,justifycenter,justifyright,justifyfull,removeformat,inserthtml',
              width:450,
              height:282
            });
            //]]>
            </script>
          </div>
        </div>
        <ul class="tabs-list" id="tabs-list-add">
          <li class="active"><a href="#tab-1">Giới thiệu</a></li>
          <li><a href="#tab-2">Thông tin</a></li>
          <li><a href="#tab-3">Mô tả chi tiết</a></li>
          <li><button class="btn btn-primary" type=submit value="Đăng bài" style="width: 110px;">Đăng lên</button></li>
        </ul>
      </div>
    </form>
  </div>
  
  <!-- Edit Product -->
  <div class="row" id="product-edit-wrapper">
    <div style="padding: 10px 15px;margin-bottom: 10px; background-color: #CDCDCD">
      <h5>Ảnh đại diện</h5>
      <hr class="hr hr2" />
      <form method="post" id="avatar-edit_form" class="form-horizontal" action=<?php echo base_url('booth_product/ajaxProductUploadFile/avatar'); ?> enctype=multipart/form-data > 
        <div class=control-group>
          <label for="avatar-edit" class="control-label">Chọn ảnh<i>*</i></label>
         	<div class="controls">
         	  <input type="file" id="avatar-edit" name="avatar-edit"/>
         	</div>
        </div>
        <button class="submit_btn" type="submit">Upload Files</button>
      </form>
      <div id="avatar-edit_append"></div>
    </div>
    <div style="padding: 10px 15px;margin-bottom: 10px; background-color: #CDCDCD">
      <h5>Album</h5>
      <hr class="hr hr2" />
      <form method="post" id="album-edit_form" class="form-horizontal" action=<?php echo base_url('booth_product/ajaxProductUploadFile/album'); ?> enctype=multipart/form-data > 
        <div class=control-group>
          <label for="album-edit" class="control-label">Chọn ảnh<i>*</i></label>
         	<div class="controls">
         	  <input type="file" id="album-edit" name="album-edit[]" multiple="multiple" />
         	</div>
        </div>
        <button class="submit_btn" type="submit">Upload Files</button>
      </form>
      <div id="album-edit_append"></div>
    </div>
    <form method="post" class="form-horizontal" id="booth-product-form-edit" action=<?php echo base_url('booth_product/add'); ?>>          
      <div class="product-form-left">
        <input type="hidden" name=category_id id="category-id-edit" value="" />
        <input type="hidden" name=booth_id id=booth-id-edit value="<?php echo $booth['id']; ?>" />
        <input type="hidden" id="avatar-editCropJson" name="avatar-editCropJson" />
        <input type="hidden" id="album-editCropJson" name="album-editCropJson" />
        <select name="product_type" id=product-type-edit>
          <option value="0">Kiểu sản phẩm</option>  
          <option value="1">Sản phẩm mới</option>  
          <option value="2">Sản phẩm khuyến mại</option>  
        </select>
 	  	<input type=text name=intro_video id=intro-video-edit placeholder="Video Youtube" >
        <input type=text name=name id=name-edit placeholder="Tên sản phẩm">
        <input type=text name=price id=price-edit placeholder="Giá bán">
        <input type=text name=base_price id=base-price-edit placeholder="Giá gốc">
        <select name="warranty" id=warranty-edit>  
          <option value="0">Bảo hành</option>
          <option value="1">3 tháng</option>
          <option value="2">6 tháng</option>
          <option value="3">9 tháng</option>
          <option value="4">12 tháng</option>
          <option value="5">18 tháng</option>
          <option value="6">24 tháng</option> 
          <option value="7">36 tháng</option>  
        </select>
        <select name="status" id=status-edit>
          <option value="0">Tình trạng</option>
          <option value="1">Còn hàng</option>  
          <option value="2">Hết hàng</option> 
        </select>
        <select name="forms" id=forms-edit>  
          <option value="0">Hình thức</option>
          <option value="1">Còn mới 30%</option>
          <option value="2">Còn mới 40%</option>
          <option value="3">Còn mới 50%</option>
          <option value="4">Còn mới 60%</option>
          <option value="5">Còn mới 70%</option> 
          <option value="6">Còn mới 80%</option>  
          <option value="7">Còn mới 90%</option>  
          <option value="8">Còn mới 92%</option>
          <option value="9">Còn mới 94%</option>
          <option value="10">Còn mới 96%</option>
          <option value="11">Còn mới 98%</option>
          <option value="12" selected>Còn mới 100%</option>  
        </select>
        <input type=text name=made_in id=made-in-edit placeholder="Xuất xứ">
	    <select name="shipping" id=shipping-edit>  
	      <option value="0">Vận chuyển</option>
          <option value="1">Miễn phí</option>
          <option value="2">Có phí</option>
          <option value="3">Liên hệ</option> 
        </select>
        <input type=text name=quantity id=quantity-edit placeholder="Số lượng hàng">
        <input style="margin-top: -2px;" type="checkbox" value="1" name="make_as_homepage" id="make-as-homepage"> <b>Đưa ra trang chủ</b> <br />
        <div style="line-height: 14px;">Sản phẩm sẽ được chọn đưa ra ngoài trang chủ (lưu ý chỉ chọn một sản phẩm duy nhất)</div>
      </div>
      <div class="pull-left" style="width: 454px;">
        <div class=tabs>
          <div id="tab-edit-1" class="tab-content" style="display: block;">
            <textarea name="description" id="description-edit"></textarea>
            <script type="text/javascript">
		    //<![CDATA[    
		    epicEditor.init({
			  containId: 'description-edit',
			  iframeId: 'epic_iframe_description-edit',
			  toolbarId: 'epic_toolbar_group_description-edit',					
			  buttons1 : 'bold,italic,underline,strikethrough,fontsize,fontname,justifyleft,justifycenter,justifyright,justifyfull,removeformat,inserthtml',
			  width:450,
			  height:282
		    });
		    //]]>
		    </script>
		  </div>
          <div id="tab-edit-2" class="tab-content">
            <textarea name="product_information" id="product_information-edit"></textarea>
            <script type="text/javascript">
		    //<![CDATA[    
		    epicEditor.init({
			  containId: 'product_information-edit',
			  iframeId: 'epic_iframe_product_information-edit',	
			  toolbarId: 'epic_toolbar_group_product_information-edit',
			  buttons1 : 'bold,italic,underline,strikethrough,fontsize,fontname,justifyleft,justifycenter,justifyright,justifyfull,removeformat,inserthtml',
			  width:450,
			  height:282
		    });
		    //]]>
		    </script>
		  </div>
          <div id="tab-edit-3" class="tab-content">
            <textarea name="product_detail" id="product_detail-edit"></textarea>
            <script type="text/javascript">
            //<![CDATA[    
            epicEditor.init({
              containId: 'product_detail-edit',
              iframeId: 'epic_iframe_product_detail-edit',	
              toolbarId: 'epic_toolbar_group_product_detail-edit',
              buttons1 : 'bold,italic,underline,strikethrough,fontsize,fontname,justifyleft,justifycenter,justifyright,justifyfull,removeformat,inserthtml',
              width:450,
              height:282
            });
            //]]>
            </script>
          </div>
        </div>
        <ul class="tabs-list" id="tabs-list-edit">
          <li class="active"><a href="#tab-edit-1">Giới thiệu</a></li>
          <li><a href="#tab-edit-2">Thông tin</a></li>
          <li><a href="#tab-edit-3">Mô tả chi tiết</a></li>
          <li><button class="btn btn-primary" type=submit value="Đăng bài" style="width: 110px;">Đăng lên</button></li>
        </ul>
      </div>
    </form>
  </div>
  
  <script type="text/javascript">
  $(document).ready(function() {
	$("#add-product").click(function() {
		$("#product-add-wrapper").show();
	});  
 
    $('.parent-categories, .child-categories').click(function(){
      var category_id = $(this).data('category');
      var href = '<?php echo base_url('booth_product/index') . '/'; ?>';
      $.get(href + category_id, function(data) {
        if(data) {
          $('#webbies').html(data);
		  
		  	// edit product
			$('#webbies li').click(function(){
			  var href = '<?php echo base_url('booth_product/getBoothProductJson') . '/'; ?>';
			  $.get(href + $(this).children().data('block'), function(data) {
				var product = $.parseJSON(data);

				var action = $('#booth-product-form-edit').attr('action') + '/' + product.id;
				$('#booth-product-form-edit').attr('action', action);
				
				$('#product-edit-wrapper #category-id-edit').val(product.category_id);
				$('#product-edit-wrapper #booth-id-edit').val(product.booth_id);
				$('#product-edit-wrapper #intro-video-edit').val(product.intro_video);
				$('#product-edit-wrapper #name-edit').val(product.name);
				$('#product-edit-wrapper #price-edit').val(product.price);
				$('#product-edit-wrapper #base-price-edit').val(product.base_price);
				$('#product-edit-wrapper #made-in-edit').val(product.made_in);
				$('#product-edit-wrapper #quantity-edit').val(product.quantity);

				$('#product-edit-wrapper #product-type-edit').val(product.product_type);
				$('#product-edit-wrapper #warranty-edit').val(product.warranty);
				$('#product-edit-wrapper #status-edit').val(product.status);
				$('#product-edit-wrapper #forms-edit').val(product.forms);
				$('#product-edit-wrapper #shipping-edit').val(product.shipping);

				if (product.make_as_homepage == 1) {
				  $('#product-edit-wrapper #make-as-homepage').attr("checked","checked");
				}
				
				//console.log(product);
				$pnk('epic_iframe_description-edit').contentWindow.document.body.innerHTML = product.description;
				$pnk('epic_iframe_product_information-edit').contentWindow.document.body.innerHTML = product.product_information;
				$pnk('epic_iframe_product_detail-edit').contentWindow.document.body.innerHTML = product.product_detail;

				$("#product-edit-wrapper").show();
			  });	
			});
        }
        $("#add-product").show();
        $("#category-id-add").val(category_id);
      });	
      return false;
    });

    // Sự kiện click tab bất kỳ
    $('#tabs-list-add li a').click(function(){ 
      $('#tabs-list-add li').removeClass('active');
      $(this).parent().addClass('active'); 
     
      var currentTab = $(this).attr('href'); 
      $('.tab-content').hide();
      $(currentTab).show();
       
      return false;
    }); // end Sự kiện click tab bất kỳ

    // Sự kiện click tab bất kỳ
    $('#tabs-list-edit li a').click(function(){ 
      $('#tabs-list-edit li').removeClass('active');
      $(this).parent().addClass('active'); 
     
      var currentTab = $(this).attr('href'); 
      $('.tab-content').hide();
      $(currentTab).show();
       
      return false;
    }); // end Sự kiện click tab bất kỳ
      	 
	$("#booth-product-form-add").validate({
		ignore: "",
		submitHandler: function(form) {
		  $pnk('description-add').value = $pnk('epic_iframe_description-add').contentWindow.document.body.innerHTML;
		  $pnk('product_information-add').value = $pnk('epic_iframe_product_information-add').contentWindow.document.body.innerHTML;
		  $pnk('product_detail-add').value = $pnk('epic_iframe_product_detail-add').contentWindow.document.body.innerHTML;
			  
		  form.submit();
		}
	});
	
	$("#booth-product-form-edit").validate({
		ignore: "",
		submitHandler: function(form) {
		  $pnk('description-edit').value = $pnk('epic_iframe_description-edit').contentWindow.document.body.innerHTML;
		  $pnk('product_information-edit').value = $pnk('epic_iframe_product_information-edit').contentWindow.document.body.innerHTML;
		  $pnk('product_detail-edit').value = $pnk('epic_iframe_product_detail-edit').contentWindow.document.body.innerHTML;
			  
		  form.submit();
		}
	});
  });
  </script> 

  <?php /*
    <div class="product-block row" style="display: none;">
      <div style="padding: 10px 15px;margin-bottom: 10px; background-color: #CDCDCD">
        <h5>Ảnh đại diện</h5>
        <hr class="hr hr2" />
        <form method="post" id="avatar_<?php echo $cnt; ?>_form" class="form-horizontal" action=<?php echo base_url('booth/ajaxProductUploadFile/avatar/' . $booth_product['id']); ?> enctype=multipart/form-data > 
          <div class=control-group>
            <label for="avatar_<?php echo $cnt; ?>" class="control-label">Chọn ảnh<i>*</i></label>
           	<div class="controls">
           	  <input type="file" id="avatar_<?php echo $cnt; ?>" name="avatar_<?php echo $cnt; ?>"/>
           	</div>
          </div>
          <button class="submit_btn" type="submit">Upload Files</button>
        </form>
        <?php
          $dir = 'upload/booth/' . $_SESSION['userLoggedIn']['id'] . '/products/avatar/' . $booth_product['id'] . '/';
          if (!file_exists($dir)) {
              $old = umask(0);
              @mkdir($dir, 0777, true); // made dir
              umask($old);
          }
          $dir_handle = opendir($dir);    
          // Loop through the files
          while ($file = readdir($dir_handle)) {
            if($file == "." || $file == ".." || $file == "index.php" || $file == "temp" )
              continue;
            echo '<img width="90" src="' . base_url($dir . $file) .'" /><div>'. $file .'</div>';
          }
          closedir($dir_handle);
        ?>
        <div id="avatar_<?php echo $cnt; ?>_append"></div>
        <form class="form-horizontal" action="<?php echo base_url('booth/addFile/avatar/' . $cnt); ?>" method="post">
          <div class="control-group">
            <div class=controls>
              <input type=hidden name=booth_products_id id=booth_products_id value="<?php echo $booth_product['id'] ?>"/>
              <input type="hidden" id="avatar_<?php echo $cnt; ?>CropJson" name="avatar_<?php echo $cnt; ?>CropJson" />
              <button class="btn" type=submit value="Lưu thay đổi">Lưu thay đổi</button>
            </div>
          </div>
        </form>
      </div>
      
      <div style="padding: 10px 15px;margin-bottom: 10px; background-color: #CDCDCD">
        <h5>Album</h5>
        <hr class="hr hr2" />
        <form method="post" id="album_<?php echo $cnt; ?>_form" class="form-horizontal" action=<?php echo base_url('booth/ajaxProductUploadFile/album/' . $booth_product['id']); ?> enctype=multipart/form-data > 
          <div class=control-group>
            <label for="album_<?php echo $cnt; ?>" class="control-label">Chọn ảnh<i>*</i></label>
           	<div class="controls">
           	  <input type="file" id="album_<?php echo $cnt; ?>" name="album_<?php echo $cnt; ?>[]" multiple="multiple" />
           	</div>
          </div>
          <button class="submit_btn" type="submit">Upload Files</button>
        </form>
        <ul class="thumbnails" style="height: auto;">
        <?php
          $dir = 'upload/booth/' . $_SESSION['userLoggedIn']['id'] . '/products/album/' . $booth_product['id'] . '/';
          if (!file_exists($dir)) {
              $old = umask(0);
              @mkdir($dir, 0777, true);
              umask($old);
          }
          $dir_handle = opendir($dir);    
          // Loop through the files
          while ($file = readdir($dir_handle)) {
            if($file == "." || $file == ".." || $file == "index.php" || $file == "temp" )
              continue;
            echo '<li style="height:60px; padding-left:5px; background-color:#CDCDCD; border-right: none; border-left: none; border-top: none;"><img width="90" src="' . base_url($dir . $file) .'" /><div>'. $file .'</div></li>';
          }
          closedir($dir_handle);
        ?>
        </ul>
        <div id="album_<?php echo $cnt; ?>_append"></div>
        <form class="form-horizontal" action="<?php echo base_url('booth/addFile/album/' . $cnt); ?>" method="post">
          <div class="control-group">
            <div class=controls>
              <input type=hidden name=booth_products_id id=booth_products_id value="<?php echo $booth_product['id'] ?>"/>
              <input type="hidden" id="album_<?php echo $cnt; ?>CropJson" name="album_<?php echo $cnt; ?>CropJson" />
              <button class="btn" type=submit value="Lưu thay đổi">Lưu thay đổi</button>
            </div>
          </div>
        </form>
      </div>
      
      <form method="post" class="product-form-<?php echo $booth_product['id']; ?>" class="form-horizontal" action=<?php echo base_url('booth/addProduct/' . $booth_product['id']); ?>>          
        <div class="pull-left" style="width: 262px;">
          <input type="hidden" name=booth_id id="booth_id" value="<?php echo $booth['id']; ?>" />
          <select name="product_type">
            <option value="0" <?php echo set_select('product_type', '0', $booth_product['product_type']==0?TRUE:FALSE); ?>>Mục sản phẩm</option>  
            <option value="1" <?php echo set_select('product_type', '1', $booth_product['product_type']==1?TRUE:FALSE); ?>>Sản phẩm mới</option>  
            <option value="2" <?php echo set_select('product_type', '2', $booth_product['product_type']==2?TRUE:FALSE); ?>>Sản phẩm khuyến mại</option>  
            <option value="3" <?php echo set_select('product_type', '3', $booth_product['product_type']==3?TRUE:FALSE); ?>>Sản phẩm thông thường</option>  
          </select>
          <?php if (isset($booth_product_categories)): ?>
            <select name="category_id" style="float:left;width: 230px !important;">
              <?php foreach($booth_product_categories as $booth_product_categorie): ?>
              <option value="<?php echo $booth_product_categorie['id']; ?>" <?php echo set_select('category_id', $booth_product_categorie['id'], $booth_product['category_id']==$booth_product_categorie['id']?TRUE:FALSE); ?>><?php echo $booth_product_categorie['name']; ?></option>    
              <?php endforeach; ?>
            </select>
          <?php endif; ?>
          <a href="<?php echo base_url('booth/boothProductCategoriesAddPopup?booth_id='. $booth['id']); ?>" rel=boothProductCategoriesAddPopup[ajax] >
          	<img style="float:left;margin: 6px 0 6px 6px" src="<?php echo base_url('theme/images/icon/new.gif'); ?>" />
          </a>
          <script src="<?php echo base_url('theme/js/frontend/jquery.trialPhoto.js'); ?>" type="text/javascript"></script>
          <script type="text/javascript">
          $(document).ready(function(){              
            // Category popup
            $("a[rel^='boothProductCategoriesAddPopup']").trialPhoto({
              ajaxcallback: function() {

              },
              width: 450,
              height: 500,
			  markup: '<div class="pp_container" role="dialog"><div class="pp_loaderIcon"></div><div class="pp_placeholder"></div></div><div class="pp_overlay"></div>'
            });
          });
          </script>
   	  	  <input type=text name=intro_video id=intro_video value="<?php echo set_value('intro_video', $booth_product['intro_video']); ?>" placeholder="Video Youtube" >
          <input type=text name=name id=name value="<?php echo set_value('name', $booth_product['name']); ?>" placeholder="Tên sản phẩm">
          <input type=text name=price id=price value="<?php echo set_value('price', $booth_product['price']); ?>" placeholder="Giá bán">
          <input type=text name=base_price id=base_price value="<?php echo set_value('base_price', $booth_product['base_price']); ?>" placeholder="Giá gốc">
          <input type=text name=date_edit id=date_edit value="<?php echo set_value('date_edit', $booth_product['date_edit']); ?>" placeholder="Cập nhật ngày">
          <input type=text name=warranty id=warranty value="<?php echo set_value('warranty', $booth_product['warranty']); ?>" placeholder="Bảo hành">
          <input type=text name=status id=status value="<?php echo set_value('status', $booth_product['status']); ?>" placeholder="Tình trạng">
          <input type=text name=forms id=forms value="<?php echo set_value('forms', $booth_product['forms']); ?>" placeholder="Hình thức">
          <input type=text name=made_in id=made_in value="<?php echo set_value('made_in', $booth_product['made_in']); ?>" placeholder="Xuất xứ">
		  <input type=text name=shipping id=shipping value="<?php echo set_value('shipping', $booth_product['shipping']); ?>" placeholder="Vận chuyển">
          <input type=text name=quantity id=quantity value="<?php echo set_value('quantity', $booth_product['quantity']); ?>" placeholder="Số lượng hàng">
        </div>
        <div class="pull-left" style="width: 454px;">
          <div class=tabs>
            <div id="tab-1-<?php echo $booth_product['id']; ?>" class="tab" style="display: block;">
              <textarea name="description" id="description-<?php echo $booth_product['id']; ?>"><?php echo set_value('description', $booth_product['description']); ?></textarea>
              <script type="text/javascript">
			  //<![CDATA[    
			  epicEditor.init({
				containId: 'description-<?php echo $booth_product['id']; ?>',
				iframeId: 'epic_iframe_description-<?php echo $booth_product['id']; ?>',
				toolbarId: 'epic_toolbar_group_description-<?php echo $booth_product['id']; ?>',					
				buttons1 : 'bold,italic,underline,strikethrough,fontsize,fontname,justifyleft,justifycenter,justifyright,justifyfull,removeformat,inserthtml',
				width:450,
				height:400
			  });
			  //]]>
			  </script>
			</div>
            <div id="tab-2-<?php echo $booth_product['id']; ?>" class="tab">
              <textarea name="product_information" id="product_information-<?php echo $booth_product['id']; ?>"><?php echo set_value('product_information', $booth_product['product_information']); ?></textarea>
              <script type="text/javascript">
			  //<![CDATA[    
			  epicEditor.init({
				containId: 'product_information-<?php echo $booth_product['id']; ?>',
				iframeId: 'epic_iframe_product_information-<?php echo $booth_product['id']; ?>',	
				toolbarId: 'epic_toolbar_group_product_information-<?php echo $booth_product['id']; ?>',
				buttons1 : 'bold,italic,underline,strikethrough,fontsize,fontname,justifyleft,justifycenter,justifyright,justifyfull,removeformat,inserthtml',
				width:450,
				height:400
			  });
			  //]]>
			  </script>
			</div>
            <div id="tab-3-<?php echo $booth_product['id']; ?>" class="tab">
              <textarea name="product_detail" id="product_detail-<?php echo $booth_product['id']; ?>"><?php echo set_value('product_detail', $booth_product['product_detail']); ?></textarea>
              <script type="text/javascript">
			  //<![CDATA[    
			  epicEditor.init({
				containId: 'product_detail-<?php echo $booth_product['id']; ?>',
				iframeId: 'epic_iframe_product_detail-<?php echo $booth_product['id']; ?>',	
				toolbarId: 'epic_toolbar_group_product_detail-<?php echo $booth_product['id']; ?>',
				buttons1 : 'bold,italic,underline,strikethrough,fontsize,fontname,justifyleft,justifycenter,justifyright,justifyfull,removeformat,inserthtml',
				width:450,
				height:400
			  });
			  //]]>
			  </script>
			</div>
          </div>
		  <script type="text/javascript">
		  $(document).ready(function() {
			// validate form on keyup and submit
			$(".product-form-<?php echo $booth_product['id']; ?>").validate({
				ignore: "",
				submitHandler: function(form) {
				  $pnk('description-<?php echo $booth_product['id']; ?>').value = $pnk('epic_iframe_description-<?php echo $booth_product['id']; ?>').contentWindow.document.body.innerHTML;
				  $pnk('product_information-<?php echo $booth_product['id']; ?>').value = $pnk('epic_iframe_product_information-<?php echo $booth_product['id']; ?>').contentWindow.document.body.innerHTML;
				  form.submit();
				}
			}); // end validate
		  });
		  </script> 
          <ul>
            <li class="active"><a href="#tab-1-<?php echo $booth_product['id']; ?>">Giới thiệu</a></li>
            <li><a href="#tab-2-<?php echo $booth_product['id']; ?>">Thông tin</a></li>
            <li><a href="#tab-3-<?php echo $booth_product['id']; ?>">Mô tả chi tiết</a></li>
            <li><button class="btn btn-primary" type=submit name=product-submit value="Đăng bài" style="width: 110px;">Đăng lên</button></li>
          </ul>
        </div>
      </form>
    </div>
  */?>